import cv2
import numpy as np
# bgr3三层通道
img = np.zeros((480, 640, 3), np.uint8)

# roi[100:200, 210:310] = [0, 255, 0]   100:200 y轴坐标从100到200  x轴从210到310
roi = img[100:600, 100:600]
roi[:, :] = [0, 0, 255]  # 相当于roi[:]
roi[100:200, 100:200] = [0, 255, 0]
roi[:, 10] = [0, 0, 0]
roi[100:200, 210:310] = [0, 255, 0]

cv2.imshow('img', roi)
key = cv2.waitKey(0)
if (key & 0xFF == ord('q')):
    cv2.destroyAllWindows()
